{% set id = random(1..9) + random() %}
{% set rows = settings.rows is defined ? settings.rows : 1 %}
<div class="pavo-widget-instagram {{settings.extra_class}}">
    {% if settings.title %}
    <h3 class="content-title">{{ settings.title }}</h3>
    {% endif %}
    {% if settings.subtitle %}
    <div class="content-subtitle">{{ settings.subtitle }}</div>
    {% endif %}
    <div id="instafeed" class="owl-carousel owl-theme" data-owlcarousel-options="{{ settings.carousel|json_encode()|escape }}">
        {% for item in settings.items %}
            {% set i = i + 1 %}
            {% if (i % rows == 1 or rows == 1) and settings.items|length > columns %}
                <div class="item">
            {% endif %}
                <div class="item">
                    <a href="{{ item.link }}" target="_blank" id="{{ item.id }}">
                        <img src="{{ item.image.url }}" alt="instagram" class="img-responsive" width="{{ item.image.width }}" height="{{ item.image.height }}" />
                        <i class="{{item.icon_type}}"></i>
                        <div class="footer">
                            <div class="inner">
                                <div class="caption">{{ item.short_caption }}</div>
                                <div class="likes"><i class="fa fa-heart-o"></i> {{ item.likes.count }}</div>
                                <div class="comments"><i class="fa fa-comment-o"></i> {{ item.comments.count }}</div>
                            </div>
                        </div>
                    </a>
                </div>
            {% if (rows == 1 or i % rows == 0 or i == settings.items|length) and settings.items|length > columns %}
                </div>
            {% endif %}
        {% endfor %}
    </div>
</div>